package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.Comment;
import com.cskaoyan.bean.ListData;
import com.cskaoyan.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/comment")
public class CommentController {

    @Autowired
    CommentService commentService;
    @RequestMapping("list")
    public BaseRespVo list(Integer page,Integer limit,Integer userId,Integer valueId,String sort,String order){
        ListData<Comment> commentListData = commentService.queryList(page, limit, userId, valueId, sort, order);
        return BaseRespVo.ok(commentListData);
    }

    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody Comment comment){
        commentService.deleteById(comment.getId());
        return BaseRespVo.ok();
    }
}
